package com.iknow.xmpp.smack.avatar;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.util.Base64;

public class AvatarExtension
  implements PacketExtension
{
  private String mData;

  public AvatarExtension(String paramString)
  {
    this.mData = paramString;
  }

  public AvatarExtension(byte[] paramArrayOfByte)
  {
    this.mData = Base64.encodeBytes(paramArrayOfByte);
  }

  public String getBase64()
  {
    return this.mData;
  }

  public byte[] getData()
  {
    return Base64.decode(this.mData);
  }

  public String getElementName()
  {
    return "data";
  }

  public String getNamespace()
  {
    return "urn:xmpp:avatar:data";
  }

  public String toXML()
  {
    StringBuilder localStringBuilder = new StringBuilder("<data xmlns=\"");
    localStringBuilder.append(getNamespace()).append("\">");
    localStringBuilder.append(this.mData);
    localStringBuilder.append("</data>");
    return localStringBuilder.toString();
  }
}